<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>03_Dom操作2</title>
</head>
<body>
<input type="text" id="i1">
<input type="text" id="i2">
<button onclick="f1()">计算</button>
<h4>显示结果:<span class="re"></span></h4>
</body>
<script>
    function f1() {
        let i = document.getElementById('i1');
        let i1 = document.querySelector('#i1');
        console.log(i1.value);
        let i2 = document.querySelector('#i2');
        console.log(i2.value);
        let re = document.querySelector('.re');
        re.innerHTML=parseInt(i1.value)+parseInt(i2.value);
    }
</script>

</html>